package com.exam.tencent;

import java.util.Arrays;
import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine().trim());
        String[] strs = new String[n];
        for (int i = 0; i < n; i++) {
            strs[i] = scanner.nextLine();
        }
        int length = strs[0].length();
        int[] nums = new int[length];
        for (int i = 0; i < length; i++) {
            StringBuilder sb = new StringBuilder();
            boolean removed = false;
            for (int j = 0; j < n; j++) {
                if(!removed && strs[j].charAt(i) == '0'){
                    continue;
                }
                removed = true;
                sb.append(strs[j].charAt(i));
            }
            String tmp = sb.length() == 0 ? "0" : sb.toString();
            nums[i] = Integer.parseInt(tmp);
        }
        Arrays.sort(nums);
        for (int i = 0; i < length; i++) {
            System.out.print(nums[i] + " ");
        }
    }
}
